home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
gemfsc18.lzh
/
AESSRC18.LZH
/
AESBIND
/
AESFSEL2.S
< prev
next >
Wrap
Text File
|
1989-07-22
|
21KB
|
462 lines
;*========================================================================
;*
;* AESFAST Public Domain GEM bindings.
;* Maintenance:
;* 02/11/89 v1.1: This source file is new with this version.
;*
;* 04/07/89 v1.2:
;* The calculation of the location of the prompt on the
;* screen has been changed. It was placed one boxchar height
;* down on the screen, putting it right below the menu bar.
;* This didn't look too good on a big-monitor system, so now
;* it is calculated by centering the box, then subtracting a
;* fixed offset from the centered Y to make it appear right
;* above the fsel'er box. The offset is 9 character heights,
;* (plus 2 extra char heights for the prompt itself), less
;* 2 pixels (just to line everything up real neat).
;*
;* 07/22/89 v1.3:
;* Bugfix...A 'bra.s' instruction was missing just before the
;* 'strcpy' routine, causing 4 bombs on a pre-1.4 machine.
;*========================================================================
.include "aesfast.sh"
.include "gemfast.sh"
.extern _gl_apversion
.extern aesblock
;*************************************************************************
;*
;* Extended fsel manager routine.
;* (Including simulation routines for pre-TOS 1.4 systems).
;*
;*************************************************************************
;-------------------------------------------------------------------------
; fsel_exinput
; This function is new with TOS 1.4, but this binding supports it in all
; TOS/AES versions with a simulation of the new routine's actions if the
; AES version we're running under is pre-TOS 1.4
;-------------------------------------------------------------------------
_fsel_exinput::
.cargs #8,.pinpath.l,.pinsel.l,.pbutton.l,.plabel.l
link a6,#-4
move.w _gl_apversion,d0 ; Check the AES version. If
cmp.w #$0104,d0 ; it's $0104, we're running
beq.s .ramaes ; on the RAM-based TOS 1.4
cmp.w #$0130,d0 ; Else, if it's less than $0130
blt simu_exinput ; we have to simulate exinput.
.ramaes:
move.l .plabel(a6),d0 ; Swap the button and prompt
move.l .pbutton(a6),.plabel(a6) ; string pointers to make the
move.l d0,.pbutton(a6) ; addrin stuff contiguous.
AControl 91,0,2,3 ; AES v1.3 & up: fsel_exinput
moveq.l #-4,d2 ; is a legal function, do it.
lea .pinpath(a6),a0 ; a0 -> addrin
ACall RET2HERE ; Call AES.
move.l .plabel(a6),d0 ; Swap the prompt string and
move.l .pbutton(a6),.plabel(a6) ; button pointers back to how
move.l d0,.pbutton(a6) ; they were on entry.
moveq.l #-4,d1 ; Return values from
lea .pbutton(a6),a1 ; intout[] array to caller
jmp (a0) ; via aes_return routine.
;*************************************************************************
; The following code and data supports the exinput simulation routines.
;
; The simulator supports *most* of the TOS 1.4 features, to wit:
;
; - A prompt string of up to 30 chars is displayed with the file selector.
; - The file selector handles <CR> like TOS 1.4 does (see comments below).
; - If the caller passes in a path with a leading '\' it will be appended
; to the current default drive & path (and the whole resulting string
; will be returned upon exit).
; - The current DTA is preserved.
; - The current drive and path is preserved.
;
; These are differences between the simulator and TOS 1.4:
;
; - There are no drive buttons in the dialog.
; - There is still a static limit of 100 files that can be displayed.
; - Long pathnames are NOT handled correctly.
; - Multiple abort/continue situations will still give problems.
; - The redraw sequence of the dialog is still the same.
;
; The things not supported are, of course, things I can't affect without
; completely re-writing the fsel_input handler.
;*************************************************************************
;-------------------------------------------------------------------------
; Define variables which will be accessed as offsets from a3.
; (Storage for these things will be allocated from the stack at runtime).
;-------------------------------------------------------------------------
.abs ; Define offsets from a3 base register...
savddrv: ds.w 1 ; Save default drive.
savdpath: ds.b 128 ; Save default path.
savipath: ds.b 128 ; Save input path for compare after <CR>.
savdta: ds.l 1 ; Save pointer to current DTA.
tmpdta: ds.b 44 ; Temporary DTA for fsel_input to use.
SAV_SZ = * ; Size of a3-relative storage.
;-------------------------------------------------------------------------
; Define variables which will be accessed as offsets from a5.
; (Storage for these things is allocated in the text segment, below).
;-------------------------------------------------------------------------
.abs ; Define offsets from a5 base register...
prmpflag: ds.w 1 ; Flag: Has one-time object fixup been done?
treeptr: ds.l 1 ; Ptr to tree: addrin for objc_draw() et. al.
azero: ds.w 1 ; A handy zero.
dialstuf: ds.w 1 ; Here things get a little ugly: The storage
ds.w 2 ; from 'dialstuff' down is the intin array
prmpstob: ds.w 1 ; for form_dial(FMD_FINISH). From prmpstob
prmpdpth: ds.w 1 ; down, it is also the intin array for
prmpclip: ds.w 4 ; objc_draw().
lastkeyCR:ds.w 1 ; Flag: was last keystroke during fsel a <CR>?
ABS_SZ = * ; Size of the a5-relative storage block.
.text
absstore: dcb.b ABS_SZ,0 ; Set aside memory for the a5-relative block.
;-------------------------------------------------------------------------
; Define the TEDINFO and OBJECT structures for the prompt text.
; (Macros for defining these things come from gemfast.sh).
;-------------------------------------------------------------------------
YSZ_PROMPT = 2
YSZ_FSEL = 9
Y_OFFSET = YSZ_PROMPT+YSZ_FSEL
prmptext: Teddef 0,0,0,3,0,TE_CNTR,$1180,0,1,31,0
prmptree: Treedef text
Objdef ,-1,-1,-1,G_BOXTEXT,LASTOB,NORMAL,0,0,0,40,YSZ_PROMPT
;-------------------------------------------------------------------------
; This routine is installed as a hook in the BIOS vector for the duration
; of the the fsel_input call. It watches for a Bconin(2) call (which will
; be the AES asking for a character). The Bconin call is done from in
; here such that we get the character back from the real BIOS and examine
; it. If the character is a <CR>, we set the flag to say so and return
; the character to the caller. If not a <CR> we clear the flag and
; return the character.
;
; The whole reason for this is a bug in the pre-TOS 1.4 AES: If the user
; edited the path but didn't click the mouse on anything or change the
; filename field, then hit <CR>, the system returned a CANCEL status. This
; BIOS hook is the only way to tell for sure that the exit was via <CR>.
;-------------------------------------------------------------------------
oldbios: dc.l 0 ; Old BIOS vector address.
bioshook:
lea 6(sp),a0 ; Assume super mode caller.
btst.b #5,(sp) ; Were we in super mode?
bne.s .supermode ; No, user mode...
move.l usp,a0 ; So look